//
//  TKYChangeStationFootView.m
//  StationHouseHelper
//
//  Created by apple on 2018/6/13.
//  Copyright © 2018年 铁科院. All rights reserved.
//

#import "TKYChangeStationFootView.h"
@interface TKYChangeStationFootView()

@property (nonatomic, strong)UIButton *settingButton;

@property (nonatomic, strong)UIButton *logoutButton;
@property (nonatomic, strong)UIView *top_line;
@property (nonatomic, strong)UIView *center_line;

@end

@implementation TKYChangeStationFootView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self addSubview:self.settingButton];
        [self addSubview:self.logoutButton];
        [self addSubview:self.top_line];
        [self addSubview:self.center_line];

    }
    return self;
}

- (UIView *)top_line {
    if (_top_line == nil) {
        _top_line = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth*0.8, 0.5)];
        _top_line.backgroundColor = kMainColour;
    }
    return _top_line;
}

- (UIView *)center_line {
    if (_center_line == nil) {
        _center_line = [[UIView alloc]initWithFrame:CGRectMake(self.kx_width/2, 0, 0.5, self.kx_height)];
        _center_line.backgroundColor = kMainColour;
    }
    return _center_line;
}


- (UIButton *)settingButton{
    if (_settingButton == nil) {
        _settingButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _settingButton.frame = CGRectMake(0, 0, self.kx_width/2 , 40);
        [_settingButton setTitle:@"  设置" forState:UIControlStateNormal];
        [_settingButton setImage:[UIImage imageNamed:@"settings"] forState:UIControlStateNormal];
        [_settingButton setTitleColor:kUIColorFromRGB(666666, 1) forState:UIControlStateNormal];
        [_settingButton addTarget:self action:@selector(settingAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _settingButton;
}

- (UIButton *)logoutButton{
    if (_logoutButton == nil) {
        _logoutButton = [UIButton buttonWithType:UIButtonTypeCustom];
        _logoutButton.frame = CGRectMake(self.kx_width/2, 0, self.kx_width/2, 40);
        [_logoutButton setTitle:@"  退出" forState:UIControlStateNormal];
        [_logoutButton setImage:[UIImage imageNamed:@"sign_out"] forState:UIControlStateNormal];
        [_logoutButton setTitleColor:kUIColorFromRGB(666666, 1) forState:UIControlStateNormal];
        [_logoutButton addTarget:self action:@selector(logoutAction:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _logoutButton;
}

- (void)settingAction:(UIButton *)button{

    if (self.setingButtonBlock) {
        self.setingButtonBlock(button);
    }
}

- (void)logoutAction:(UIButton *)button{
    NSLog(@"sss");
    if (self.logOutButtonBlock) {
        self.logOutButtonBlock(button);
    }
}
@end
